home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Mark Pilgrim / Jotto ][ 1.2 / source / Wipes reversed ƒ / Quadrant scroll reversed.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-30  |  2.7 KB  |  79 lines  |  [TEXT/MMCC]

  1. #include "timing.h"
  2.  
  3. #define CorrectTime 3
  4. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  5. #define theWindowWidth (boundsRect.right-boundsRect.left)
  6. #define NUM_ITERATIONS    25
  7.  
  8. pascal short QuadrantScrollReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  9.  
  10. /* 4 regions, splitting the screen into 4 quadrants.  Scroll the screen left in
  11.    the top-left quadrant, up in the top-right, right in the bottom-right,
  12.    down in the bottom-left. */
  13.    
  14. pascal short QuadrantScrollReversed(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  15. {
  16.     short            x;
  17.     Rect        tlsource, trsource, blsource, brsource;
  18.     Rect        tldest, trdest, bldest, brdest;
  19.     Rect        tlscroll, trscroll, blscroll, brscroll;
  20.     short            cx,cy;
  21.     short            BoxSize, HBoxSize;
  22.     
  23.     BoxSize=theWindowHeight/(NUM_ITERATIONS*2);
  24.     HBoxSize=theWindowWidth/(NUM_ITERATIONS*2);
  25.     
  26.     cx = boundsRect.left + theWindowWidth / 2;
  27.     cy = boundsRect.top + theWindowHeight / 2;
  28.     
  29.     tlscroll=trscroll=blscroll=brscroll=tldest=trdest=bldest=brdest=boundsRect;
  30.     tlscroll.right=trscroll.left=blscroll.right=brscroll.left=
  31.         tldest.right=trdest.left=bldest.right=brdest.left=cx;
  32.     tlscroll.bottom=trscroll.bottom=blscroll.top=brscroll.top=
  33.         tldest.bottom=trdest.bottom=bldest.top=brdest.top=cy;
  34.     brdest.right=brdest.left+HBoxSize;
  35.     bldest.bottom=bldest.top+BoxSize;
  36.     tldest.left=tldest.right-HBoxSize;
  37.     trdest.top=trdest.bottom-BoxSize;
  38.     
  39.     SetRect(&tlsource, boundsRect.left, boundsRect.top, boundsRect.left+HBoxSize, cy);
  40.     SetRect(&trsource, cx, boundsRect.top, boundsRect.right, boundsRect.top+BoxSize);
  41.     SetRect(&brsource, boundsRect.right-HBoxSize, cy, boundsRect.right, boundsRect.bottom);
  42.     SetRect(&blsource, boundsRect.left, boundsRect.bottom-BoxSize, cx, boundsRect.bottom);
  43.     
  44.     for (x=0; x<NUM_ITERATIONS; x++)
  45.     {
  46.         StartTiming();
  47.         ScrollTheRect(&brscroll, HBoxSize, 0, 0L);
  48.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  49.                 &brsource, &brdest, 0, 0L);
  50.         brsource.left-=HBoxSize;
  51.         brsource.right-=HBoxSize;
  52.         
  53.         ScrollTheRect(&blscroll, 0, BoxSize, 0L);
  54.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  55.                 &blsource, &bldest, 0, 0L);
  56.         blsource.top-=BoxSize;
  57.         blsource.bottom-=BoxSize;
  58.         
  59.         ScrollTheRect(&tlscroll, -HBoxSize, 0, 0L);
  60.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  61.                 &tlsource, &tldest, 0, 0L);
  62.         tlsource.left+=HBoxSize;
  63.         tlsource.right+=HBoxSize;
  64.         
  65.         ScrollTheRect(&trscroll, 0, -BoxSize, 0L);
  66.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  67.                 &trsource, &trdest, 0, 0L);
  68.         trsource.top+=BoxSize;
  69.         trsource.bottom+=BoxSize;
  70.         
  71.         TimeCorrection(CorrectTime);
  72.     }
  73.     
  74.     CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  75.         &boundsRect, &boundsRect, 0, 0L);
  76.     
  77.     return 0;
  78. }
  79.